﻿using System;
using System.Collections.Generic;
using STeaL.Functional;

namespace STeaL.Algorithm {

  public static partial class IListExtensions {
#region back
    public static T back<T>(this IList<T> list)
      { return list[list.Count-1]; }

#endregion
#region push_back
    public static void push_back<T>(this IList<T> list, T item)
      { list.Insert(list.Count, item); }

#endregion
#region pop_back
    public static void pop_back<T>(this IList<T> list)
      { list.RemoveAt(list.Count-1); }

    public static void pop_back<T>(this IList<T> list, out T val) {
      val = list.back();
      list.pop_back();
    }

#endregion
  }
}
